package com.mergeades.chp05;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class FairAndUnfairTest {

    private static class ReentrantLock2 extends ReentrantLock {

        public ReentrantLock2(boolean fair) {
            super(fair);
        }

        public Collection<Thread> getQueuedThreads() {
            List<Thread> arrayList = new ArrayList<Thread>(super.getQueuedThreads());
            Collections.reverse(arrayList);
            return arrayList;
        }

    }

    private static class Job extends Thread {

        private Lock lock;

        public Job(Lock lock) { this.lock = lock;

        }

        public void run() { // 连续2次打印当前的Thread和等待队列中的Thread（略）

        }

    }
}
